import request from "@/utils/request";
export const service = "/ttmanage";

// 组件信息查询
export function queryViewComponent(data) {
  return request({
    url: service + "/industry/compo/queryViewComponent",
    method: "post",
    data: data,
  });
}

// 编辑模版组件
export function modifyViewComponent(data) {
  return request({
    url: service + "/industry/compo/modifyViewComponent",
    method: "post",
    data: data,
  });
}

// 新增模版组件
export function addViewComponent(data) {
  return request({
    url: service + "/industry/compo/addViewComponent",
    method: "post",
    data: data,
  });
}

// 删除组件
export function delViewComponent(data) {
  return request({
    url: service + "/industry/compo/delViewComponent",
    method: "post",
    data: data,
  });
}

// 上传删除
export function uploadDelete(data) {
  return request({
    url: "/upload/delete",
    method: "post",
    data: data,
  });
}

// 查询目录
export function queryViewDir(data) {
  return request({
    url: service + "/industry/compo/queryViewDir",
    method: "post",
    data: data,
  });
}

// 添加目录
export function addViewDir(data) {
  return request({
    url: service + "/industry/compo/addViewDir",
    method: "post",
    data: data,
  });
}

// 删除目录
export function delViewDir(data) {
  return request({
    url: service + "/industry/compo/delViewDir",
    method: "post",
    data: data,
  });
}

// 删除大屏配置目录校验
export function deleteViewDirCheck(data) {
  return request({
    url: service + "/industry/compo/deleteViewDirCheck",
    method: "post",
    data: data,
  });
}

// 修改目录
export function modifyViewDir(data) {
  return request({
    url: service + "/industry/compo/modifyViewDir",
    method: "post",
    data: data,
  });
}

// 查询模版
export function queryViewTemplate(data) {
  return request({
    url: service + "/industry/compo/queryViewTemplate",
    method: "post",
    data: data,
  });
}

// 添加模版
export function addViewTemplate(data) {
  return request({
    url: service + "/industry/compo/addViewTemplate",
    method: "post",
    data: data,
  });
}

// 删除模板
export function delViewTemplate(data) {
  return request({
    url: service + "/industry/compo/delViewTemplate",
    method: "post",
    data: data,
  });
}

// 修改模版
export function modifyViewTemplate(data) {
  return request({
    url: service + "/industry/compo/modifyViewTemplate",
    method: "post",
    data: data,
  });
}

// 图片上传
export function uploadImg(data) {
  return request({
    url: "/file/base/common/upload",
    method: "post",
    data: data,
  });
}

// 查询当前试图
export function queryViewCustRel(data) {
  return request({
    url: service + "/industry/compo/queryViewCustRel",
    method: "post",
    data: data,
  });
}

// 删除当前视图
export function delViewCustRel(data) {
  return request({
    url: service + "/industry/compo/delViewCustRel",
    method: "post",
    data: data,
  });
}

// 查询当前视图
export function queryViewByCust(data) {
  return request({
    url: service + "/industry/compo/queryViewByCust",
    method: "post",
    data: data,
  });
}

// 修改当前视图
export function modifyViewCustRel(data) {
  return request({
    url: service + "/industry/compo/modifyViewCustRel",
    method: "post",
    data: data,
  });
}

// 添加当前视图
export function addViewCustRel(data) {
  return request({
    url: service + "/industry/compo/addViewCustRel",
    method: "post",
    data: data,
  });
}
// 新增组件鉴权
export function addCompoAuthority(data) {
  return request({
    url: service + "/industry/compo/auth/addCompoAuthority",
    method: "post",
    data: data,
  });
}
// 修改组件鉴权
export function modifyCompoAuthority(data) {
  return request({
    url: service + "/industry/compo/auth/modifyCompoAuthority",
    method: "post",
    data: data,
  });
}
// 删除组件鉴权
export function delCompoAuthority(data) {
  return request({
    url: service + "/industry/compo/auth/delCompoAuthority",
    method: "post",
    data: data,
  });
}
// 查询组件鉴权
export function queryCompoAuthority(data) {
  return request({
    url: service + "/industry/compo/auth/queryCompoAuthority",
    method: "post",
    data: data,
  });
}

/**
 * 通过URL下载文件
 *
 * @param url 文件的URL地址
 * @returns Promise对象，用于异步处理下载结果
 */
export function downloadByUrl(url) {
  return request({
    url: "/file/common/downloadByUrl",
    method: "get",
    params: {
      url: url,
    },
  });
}
